home *** CD-ROM | disk | FTP | other *** search
- package assets.buildings
- {
- import assets.buildings.parts.*;
- import flash.display.*;
- import flash.events.*;
- import flash.geom.Point;
-
- [Embed(source="/_assets/assets.swf", symbol="assets.buildings.building3")]
- public class building3 extends MovieClip
- {
-
-
- public var pp:Point;
-
- public var deep:Number = 30;
-
- public var space:Number = 10;
-
- public var scope:Object;
-
- public var planes:Array;
-
- public var dist:Number;
-
- public var wide:Number = 154;
-
- public function building3(param1:*)
- {
- pp = new Point(350 + 150,200);
- deep = 30;
- wide = 154;
- space = 10;
- planes = new Array();
- super();
- setData();
- scope = param1;
- addEventListener(Event.ENTER_FRAME,render);
- addEventListener(Event.REMOVED_FROM_STAGE,onRemove);
- }
-
- public function setData() : *
- {
- planes.push({
- "A":new Point(154,0),
- "B":new Point(154,-20),
- "cl":10053171,
- "al":1
- });
- planes.push({
- "A":new Point(150,-20),
- "B":new Point(154,-20),
- "cl":13408614,
- "al":1
- });
- planes.push({
- "A":new Point(150,-20),
- "B":new Point(150,-450),
- "cl":4399361,
- "al":1
- });
- planes.push({
- "A":new Point(153,-150),
- "B":new Point(153,-160),
- "cl":10053171,
- "al":1
- });
- planes.push({
- "A":new Point(150,-150),
- "B":new Point(153,-150),
- "cl":6697728,
- "al":1
- });
- planes.push({
- "A":new Point(153,-300),
- "B":new Point(153,-310),
- "cl":10053171,
- "al":1
- });
- planes.push({
- "A":new Point(150,-300),
- "B":new Point(153,-300),
- "cl":6697728,
- "al":1
- });
- planes.push({
- "A":new Point(153,-450),
- "B":new Point(153,-460),
- "cl":10053171,
- "al":1
- });
- planes.push({
- "A":new Point(150,-450),
- "B":new Point(153,-450),
- "cl":6697728,
- "al":1
- });
- planes.push({
- "A":new Point(-154,0),
- "B":new Point(-154,-20),
- "cl":10053171,
- "al":1
- });
- planes.push({
- "A":new Point(-150,-20),
- "B":new Point(-154,-20),
- "cl":13408614,
- "al":1
- });
- planes.push({
- "A":new Point(-150,-20),
- "B":new Point(-150,-450),
- "cl":4399361,
- "al":1
- });
- planes.push({
- "A":new Point(-153,-150),
- "B":new Point(-153,-160),
- "cl":10053171,
- "al":1
- });
- planes.push({
- "A":new Point(-150,-150),
- "B":new Point(-153,-150),
- "cl":6697728,
- "al":1
- });
- planes.push({
- "A":new Point(-153,-300),
- "B":new Point(-153,-310),
- "cl":10053171,
- "al":1
- });
- planes.push({
- "A":new Point(-150,-300),
- "B":new Point(-153,-300),
- "cl":6697728,
- "al":1
- });
- planes.push({
- "A":new Point(-153,-450),
- "B":new Point(-153,-460),
- "cl":10053171,
- "al":1
- });
- planes.push({
- "A":new Point(-150,-450),
- "B":new Point(-153,-450),
- "cl":6697728,
- "al":1
- });
- }
-
- public function onRemove(param1:Event) : *
- {
- removeEventListener(Event.ENTER_FRAME,render);
- removeEventListener(Event.REMOVED_FROM_STAGE,onRemove);
- }
-
- public function drawPlane(param1:*) : *
- {
- var _loc2_:* = undefined;
- var _loc3_:* = undefined;
- var _loc4_:* = undefined;
- var _loc5_:* = undefined;
- var _loc6_:* = undefined;
- var _loc7_:* = undefined;
- var _loc8_:* = undefined;
- var _loc9_:* = undefined;
- var _loc10_:* = undefined;
- var _loc11_:* = undefined;
- var _loc12_:* = undefined;
- var _loc13_:* = undefined;
- _loc2_ = new Point(pp.x - (x + param1.A.x),pp.y - y);
- _loc3_ = Math.atan2(_loc2_.y,_loc2_.x);
- _loc4_ = -deep * (1 / Math.tan(_loc3_));
- _loc5_ = new Point(pp.x - (x + param1.A.x),pp.y - (y + param1.A.y));
- _loc6_ = Math.atan2(_loc5_.y,_loc5_.x);
- _loc7_ = _loc4_ * Math.tan(_loc6_);
- _loc8_ = new Point(pp.x - (x + param1.B.x),pp.y - y);
- _loc9_ = Math.atan2(_loc8_.y,_loc8_.x);
- _loc10_ = -deep * (1 / Math.tan(_loc9_));
- _loc11_ = new Point(pp.x - (x + param1.B.x),pp.y - (y + param1.B.y));
- _loc12_ = Math.atan2(_loc11_.y,_loc11_.x);
- _loc13_ = _loc10_ * Math.tan(_loc12_);
- graphics.beginFill(param1.cl,param1.al);
- graphics.moveTo(param1.A.x,param1.A.y);
- graphics.lineTo(param1.A.x + _loc4_,param1.A.y + _loc7_);
- graphics.lineTo(param1.B.x + _loc10_,param1.B.y + _loc13_);
- graphics.lineTo(param1.B.x,param1.B.y);
- graphics.lineTo(param1.A.x,param1.A.y);
- graphics.endFill();
- }
-
- public function render(param1:Event) : *
- {
- var _loc2_:* = undefined;
- graphics.clear();
- _loc2_ = 0;
- while(_loc2_ < planes.length)
- {
- drawPlane(planes[_loc2_]);
- _loc2_++;
- }
- }
-
- public function addElements() : *
- {
- var _loc1_:* = undefined;
- var _loc2_:* = undefined;
- var _loc3_:* = undefined;
- var _loc4_:MovieClip = null;
- _loc1_ = new Point(pp.x - x,pp.y - y);
- _loc2_ = Math.atan2(_loc1_.y,_loc1_.x);
- _loc3_ = 1 / Math.tan(_loc2_);
- (_loc4_ = new railing1()).x = x + -45 + _loc4_.deep * _loc3_;
- _loc4_.y = 340;
- scope.elementArray.push(_loc4_);
- scope.element.addChild(_loc4_);
- }
- }
- }
-